package com.ean.backpack.domain;

import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.format.annotation.DateTimeFormat;

@Entity
@Table(name = "parentregionlist")
public class Parentregionlist implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8825241879394190318L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "RegionID")
	private Integer regionId;

	public Integer getRegionId() {
		return this.regionId;
	}

	public void setRegionId(Integer id) {
		this.regionId = id;
	}

	@Column(name = "RegionType", length = 50)
	private String regionType;

	@Column(name = "RelativeSignificance", length = 3)
	private String relativeSignificance;

	@Column(name = "SubClass", length = 50)
	private String subClass;

	@Column(name = "RegionName", length = 255)
	private String regionName;

	@Column(name = "RegionNameLong", length = 510)
	private String regionNameLong;

	@Column(name = "ParentRegionID")
	private Integer parentRegionId;

	@Column(name = "ParentRegionType", length = 50)
	private String parentRegionType;

	@Column(name = "ParentRegionName", length = 255)
	private String parentRegionName;

	@Column(name = "ParentRegionNameLong", length = 510)
	private String parentRegionNameLong;

	@Column(name = "TimeStamp")
	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(style = "MM")
	private Calendar timeStamp;

	public String getRegionType() {
		return regionType;
	}

	public void setRegionType(String regionType) {
		this.regionType = regionType;
	}

	public String getRelativeSignificance() {
		return relativeSignificance;
	}

	public void setRelativeSignificance(String relativeSignificance) {
		this.relativeSignificance = relativeSignificance;
	}

	public String getSubClass() {
		return subClass;
	}

	public void setSubClass(String subClass) {
		this.subClass = subClass;
	}

	public String getRegionName() {
		return regionName;
	}

	public void setRegionName(String regionName) {
		this.regionName = regionName;
	}

	public String getRegionNameLong() {
		return regionNameLong;
	}

	public void setRegionNameLong(String regionNameLong) {
		this.regionNameLong = regionNameLong;
	}

	public Integer getParentRegionId() {
		return parentRegionId;
	}

	public void setParentRegionId(Integer parentRegionId) {
		this.parentRegionId = parentRegionId;
	}

	public String getParentRegionType() {
		return parentRegionType;
	}

	public void setParentRegionType(String parentRegionType) {
		this.parentRegionType = parentRegionType;
	}

	public String getParentRegionName() {
		return parentRegionName;
	}

	public void setParentRegionName(String parentRegionName) {
		this.parentRegionName = parentRegionName;
	}

	public String getParentRegionNameLong() {
		return parentRegionNameLong;
	}

	public void setParentRegionNameLong(String parentRegionNameLong) {
		this.parentRegionNameLong = parentRegionNameLong;
	}

	public Calendar getTimeStamp() {
		return timeStamp;
	}

	public void setTimeStamp(Calendar timeStamp) {
		this.timeStamp = timeStamp;
	}

	@Override
	public String toString() {
		return ReflectionToStringBuilder.toString(this,
				ToStringStyle.SHORT_PREFIX_STYLE);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((parentRegionId == null) ? 0 : parentRegionId.hashCode());
		result = prime
				* result
				+ ((parentRegionName == null) ? 0 : parentRegionName.hashCode());
		result = prime
				* result
				+ ((parentRegionNameLong == null) ? 0 : parentRegionNameLong
						.hashCode());
		result = prime
				* result
				+ ((parentRegionType == null) ? 0 : parentRegionType.hashCode());
		result = prime * result
				+ ((regionId == null) ? 0 : regionId.hashCode());
		result = prime * result
				+ ((regionName == null) ? 0 : regionName.hashCode());
		result = prime * result
				+ ((regionNameLong == null) ? 0 : regionNameLong.hashCode());
		result = prime * result
				+ ((regionType == null) ? 0 : regionType.hashCode());
		result = prime
				* result
				+ ((relativeSignificance == null) ? 0 : relativeSignificance
						.hashCode());
		result = prime * result
				+ ((subClass == null) ? 0 : subClass.hashCode());
		result = prime * result
				+ ((timeStamp == null) ? 0 : timeStamp.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Parentregionlist other = (Parentregionlist) obj;
		if (parentRegionId == null) {
			if (other.parentRegionId != null)
				return false;
		} else if (!parentRegionId.equals(other.parentRegionId))
			return false;
		if (parentRegionName == null) {
			if (other.parentRegionName != null)
				return false;
		} else if (!parentRegionName.equals(other.parentRegionName))
			return false;
		if (parentRegionNameLong == null) {
			if (other.parentRegionNameLong != null)
				return false;
		} else if (!parentRegionNameLong.equals(other.parentRegionNameLong))
			return false;
		if (parentRegionType == null) {
			if (other.parentRegionType != null)
				return false;
		} else if (!parentRegionType.equals(other.parentRegionType))
			return false;
		if (regionId == null) {
			if (other.regionId != null)
				return false;
		} else if (!regionId.equals(other.regionId))
			return false;
		if (regionName == null) {
			if (other.regionName != null)
				return false;
		} else if (!regionName.equals(other.regionName))
			return false;
		if (regionNameLong == null) {
			if (other.regionNameLong != null)
				return false;
		} else if (!regionNameLong.equals(other.regionNameLong))
			return false;
		if (regionType == null) {
			if (other.regionType != null)
				return false;
		} else if (!regionType.equals(other.regionType))
			return false;
		if (relativeSignificance == null) {
			if (other.relativeSignificance != null)
				return false;
		} else if (!relativeSignificance.equals(other.relativeSignificance))
			return false;
		if (subClass == null) {
			if (other.subClass != null)
				return false;
		} else if (!subClass.equals(other.subClass))
			return false;
		if (timeStamp == null) {
			if (other.timeStamp != null)
				return false;
		} else if (!timeStamp.equals(other.timeStamp))
			return false;
		return true;
	}

}
